﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace Core.Rules
{
    /// <summary>
    /// Check whether the author has after _first_ reply
    /// </summary>
    public class AuthorReplied_Rule : IRule
    {
        public double apply(SiteEnum site, QuestionInformation info)
        {
            int numberOfReplies = 0;
            //Check if the author in the QuestionInformation has replied since original question
            for (int i = 1; i < info.Replies.Count; i++) 
            {
                if (info.Replies[i].Author == info.Question.Author)
                {
                    numberOfReplies++;
                }
            }

            return numberOfReplies;
        }

        public string RuleName
        {
            get { return "AuthorReplied_Rule"; }
        }
    }
}
